
$(function(){

    // Accordion
    $("#accordion").accordion({
        header: "h3"
    });

    // Tabs
    $('#tabs').tabs();


    // Dialog
    $( "#dialog:ui-dialog" ).dialog( "destroy" );
    $( "#dialog-form" ).dialog({
        autoOpen: false,
        width:450,
        modal: true,
        buttons: {
            "Send Email": function() {
                
                var subject = $( "#subject1" ).val(),
                msg = $( "#message1" ).val();
                

                if(subject==""){
                    $("#subject1").css({'background-color' : '#FFFFEEE'});
                }else{
                    $("#sub").val(subject);
                    $("#mssg").val(msg);
                    $("#action").val("sendmsg");
                    $('form#frm1').submit();
                }
            },
            Cancel: function() {
                $( this ).dialog( "close" );
            }
        },
        close: function() {
            allFields.val( "" ).removeClass( "ui-state-error" );
        }
    });

    $( "#SendEmail" )
    .button()
    .click(function() {
        $( "#dialog-form" ).dialog( "open" );
    });



    $('#dialog').dialog({
        autoOpen: true,
        width: 600,
        buttons: {
            "Ok": function() {
                $(this).dialog("close");
            },
            "Cancel": function() {
                $(this).dialog("close");
            }
        }
    });
    $( "#dialog-confirm" ).dialog({
        resizable: false,
        height:140,
        modal: true,
        autoOpen: false,
        buttons: {
            "Delete": function() {
                $( this ).dialog( "close" );
                
            },
            Cancel: function() {
                $( this ).dialog( "close" );
               
            }
        }
    });
    $('#message').dialog({
        autoOpen: true,
        width: 600,
        buttons: {
            "Ok": function() {
                $(this).dialog("close");
            }
        }
    });

    // Dialog Link
    $('#dialog_link').click(function(){
        $('#dialog').dialog('open');
        return false;
    });

    // Datepicker
    $('#datepicker').datepicker({
        inline: true
    });

    // Slider
    $('#slider').slider({
        range: true,
        values: [17, 67]
    });

    // Progressbar
    $("#progressbar").progressbar({
        value: 20
    });

    //hover states on the static widgets
    $('#dialog_link, ul#icons li').hover(
        function() {
            $(this).addClass('ui-state-hover');
        },
        function() {
            $(this).removeClass('ui-state-hover');
        }
        );

});

